body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#visualization {
    height: 400px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    margin: 20px 0;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 4px;
}

.bar {
    background: #4CAF50;
    transition: all 0.3s ease;
    flex: 1 0 auto;
    text-align: center;
    color: white;
    font-size: 12px;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#algorithm-explanation {
    flex: 1 1 100%;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #2c3e50;
    border: 1px solid #dee2e6;
    transition: opacity 0.3s ease;
    white-space: pre-wrap;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

button {
    padding: 8px 16px;
    background: #2196F3;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #1976D2;
}

select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.bar.active {
    background: #ff9800;
}

.bar.swapping {
    background: #f44336;
}

@media (max-width: 600px) {
    .bar {
        font-size: 8px;
    }
}